﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;

namespace ELTE.SEM.Data.Repository
{
    public class ErrorLogRepository : Repository<ErrorLog>, IErrorLogRepository
    {
        public ErrorLogRepository(DbContext context) : base(context) { }

        public bool AddErrorLog(string className, string methodName, string exception, string additionalMessage)
        {
            try
            {
                Insert(new ErrorLog { ClassName = className, MethodName = methodName, Exception = exception, AdditionalMessage = additionalMessage });
                Save();
                return true;
            }
            catch (Exception ex)
            {
                return false;
            }
            
        }
    }
}
